class CommentsController < ApplicationController

  before_filter :get_plan

  def create
      @comment = @plan.comments.build(params[:comment])
      if @comment.save
          flash[:notice] = "Comment was successfully saved"
          redirect_to(@plan)
      else
          flash[:notice] = "Comment was not saved"
          redirect_to(@plan)
      end


  end

  def update

  end

  def destroy

  end

  private
    def get_plan
        @plan = Plan.find(params[:plan_id])
    end
end
